from flask import render_template
from flask_mail import Message

from cfg import mail


# 示例：发送邮件

def send_email(to, subject, body):
    msg = Message(subject=subject, recipients=[to], body=body)
    mail.send(msg)


# 示例：发送重设密码验证码邮件
def send_reset_password_email(to, verification_code):
    msg = Message('重设密码验证码', recipients=[to])
    msg.html = render_template('reset_password_email.html', verification_code=verification_code,email=to)
    mail.send(msg)
